package cpsobras.servico;

import java.util.List;
import org.hibernate.Session;



public class ServicoDAOImp implements ServicoDAO{
	private Session session;
	
	public void setSession(Session session){
		this.session = session;
	}

	@Override
	public void salvar(Servico servico) {
		this.session.save(servico);
	}

	@Override
	public void atualizar(Servico servico) {
		this.session.update(servico);
	}

	@Override
	public void excluir(Servico servico) {
		this.session.delete(servico);
	}

	@Override
	public Servico carregar(Integer codigo) {
		// TODO Auto-generated method stub
		return (Servico)this.session.get(Servico.class, codigo);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Servico> listar() {
		// TODO Auto-generated method stub
		return this.session.createCriteria(Servico.class).list();
	}
	
}
